<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <script type="text/javascript">
        function setDateTime() {
            var date = new Date();
            var day = date.getDay();
            var week;
            switch (day) {
                case 0:
                    week = "星期日";
                    break;
                case 1:
                    week = "星期一";
                    break;
                case 2:
                    week = "星期二";
                    break;
                case 3:
                    week = "星期三";
                    break;
                case 4:
                    week = "星期四";
                    break;
                case 5:
                    week = "星期五";
                    break;
                case 6:
                    week = "星期六";
                    break;
            }
            var hours = (date.getHours() < 10) ? "0" + date.getHours() : date.getHours();
            var minutes = (date.getMinutes() < 10) ? "0" + date.getMinutes() : date.getMinutes();
            var seconds = (date.getSeconds() < 10) ? "0" + date.getSeconds() : date.getSeconds();
            var today = date.getFullYear() + "年" + (date.getMonth() + 1) + "月"
                    + date.getDate() + "日  " + week + " " + hours + ":"
                    + minutes + ":" + seconds;
            document.getElementById("today").innerHTML = today;
        }
        window.setInterval("setDateTime()", 1000);
    </script>

    <script type="text/javascript">
        function check() {
            if (confirm("您确定要退出吗?")) {
                window.location.href = "${pageContext.request.contextPath}/logout?uname=<%=session.getAttribute("admin")%>";
            }
        }
    </script>
    <title>学生信息管理系统主界面</title>
</head>

<body>
<div>
    <div>
        <div>
            <div>
                <img src="${pageContext.request.contextPath}/image/logo.png" alt="学生管理系统logo" width="25%" height="10%"/>
            </div>
            <br/>

            <div style="margin-right: 25px">

                <%
                    if (null == session.getAttribute("admin")) {%>
                <a href="${pageContext.request.contextPath}/login">登录</a>
                <% } else {%>
                欢迎管理员：<font color="red"><%=session.getAttribute("admin")%>
                <%} %>

            </font>&nbsp;&nbsp;&nbsp;
                <i class="icon-time"></i>&nbsp;&nbsp;<font id="today"></font>
            </div>
        </div>
    </div>
</div>
<div class="row-fluid">
    <div class="span12">
        <div class="navbar">
            <div class="navbar-inner">

                <ul class="nav">
                    <li style="float: left"><a style="text-decoration:none; " class="brand"
                                               href="${pageContext.request.contextPath}/index">&nbsp;首页</a>
                    </li>
                    <li style="float: left"><a style="text-decoration:none; " class="brand"
                                               href="${pageContext.request.contextPath}/students/list">
                        &nbsp;查看全部学生信息</a>
                    </li>
                    <li style="float: left"><a style="text-decoration:none; " href="${pageContext.request.contextPath}/students/add">
                        &nbsp;添加学生信息 </a></li>
                    <li style="float: left"><a style="text-decoration:none; " href="${pageContext.request.contextPath}/students/course_list">&nbsp;查看所有课程信息 </a>
                    </li>
                    <li style="float: left"><a style="text-decoration:none; " href="${pageContext.request.contextPath}/students/course_add">&nbsp;添加课程</a>
                    </li>
                    <%if (session.getAttribute("admin") != null) {%>
                    <li style="float: left"><a style="text-decoration:none;cursor: pointer"
                                               onclick="check()">
                        &nbsp;退出系统</a></li>
                    <%}%>
                </ul>
            </div>
        </div>
    </div>
</div>
</body>
</html>